﻿using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;

namespace Hxsoft.AppV1.Admin.RoleManage.Controls
{
	public partial class Role : BaseUserControl
	{
		protected void Page_Load(object sender, EventArgs e)
		{
			if (!IsPostBack)
			{
				this.DataBind();
			}
		}

		/// <summary>
		/// 属性 RoleName
		/// </summary>
		public string RoleName
		{
			get
			{
				return Convert.ToString(CtrlRoleName.Text);
			}
			set
			{
				CtrlRoleName.Text = value.ToString();
			}
		}

		/// <summary>
		/// 属性 Description
		/// </summary>
		public string Description
		{
			get
			{
				if (String.IsNullOrEmpty(CtrlDescription.Text))
					return null;

				return Convert.ToString(CtrlDescription.Text);
			}
			set
			{
				if (value == null)
					CtrlDescription.Text = "";
				else
					CtrlDescription.Text = value.ToString();
			}
		}

		/// <summary>
		/// 控件的 RoleInfo 实例。
		/// </summary>
		public Hxsoft.AppV1.Module.Role Info
		{
			get
			{
				Hxsoft.AppV1.Module.Role role = new Hxsoft.AppV1.Module.Role();

				role.RoleName = RoleName;
				role.Description = Description;

				return role;
			}
			set
			{
				if (value == null) return;

				RoleName = value.RoleName;
				Description = value.Description;
			}
		}
	}
}